﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Common_BMindex : System.Web.UI.Page
{

    public string navstring;
    public static string userName="登陆";
    public string indexImages;
    public string myControl1;
    public string myControl2;
    public string myControl3;
    public string myControl4;
    protected int NumbersOfImages = 0;
    protected void Page_Load(object sender, EventArgs e)
    {

        
        if (Session["userName"] == null)
        {

            if (userName.Equals("登陆"))
            {
                navstring = "<a id=\"myid1\" href=\"#\" data-toggle=\"modal\" data-target=\"#myModal\"><span  class=\"glyphicon glyphicon-log-in\"></span> 登录";
            }
            else
            {
                navstring = " <a id=\"myid1\" href=\"#\" data-toggle=\"modal\" data-target=\"#myModal\"><span  class=\"glyphicon glyphicon-log-in\"></span>" + userName;
            }
        }



           
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string bookName = "";
        string url = "";
        bookName = TBfindbook.Value.ToString();
        url = "FindBook.aspx?bookName=" + bookName;
        Response.Redirect(url);
    }
    protected void UserLogin(object sender, EventArgs e)
    {
        SQL sql = new SQL();
        if (sql.LogIn(TBuserName.Text, TBuserPsw.Text))
        {
            userName = TBuserName.Text;
            navstring = "<a href=\"../User/UserIndexInfo.aspx\"><span  class=\"glyphicon glyphicon-user\"></span>   " + userName;
            Session.Add("userName", userName);

        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "alert('密码错误，请重新输入')", true); 
        }
 
    }
    protected void hidetext_TextChanged(object sender, EventArgs e)
    {
        string bookName = "";
        string url = "";
        bookName = hidetext.Text;
        url = "FindBook.aspx?bookName=" + bookName;
        Response.Redirect(url);
    }
}